home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / terminal / top_152 / src152.exe / rar / TOP7PL.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-16  |  5KB  |  171 lines

  1. {┌─────────────────────────────────────────────────────────────────────────┐}
  2. {│                                                                         │}
  3. {│                              T. O. P.                                   │}
  4. {│                                                                         │}
  5. {│                        (T)he  (O)ther  (P)acket                         │}
  6. {│                                                                         │}
  7. {│ T O P 7 P L . P A S                                                     │}
  8. {│                                                                         │}
  9. {│                                                                         │}
  10. {│ Routinen fuer den Empfang von 7Plusfiles                                │}
  11. {└─────────────────────────────────────────────────────────────────────────┘}
  12.  
  13.  
  14. Procedure Open_Close_7Plus (* Kanal : Byte; Zeile : Str80 *);
  15. Const   Cnt    = 'CNT';
  16. Var     i,i1   : Byte;
  17.         Result : Word;
  18.         Sstr   : String[8];
  19.         Nstr   : String[12];
  20.         Vstr   : String[80];
  21.         Suf    : String[3];
  22.         Flag   : Boolean;
  23.         f      : Text;
  24. Begin
  25.   with K[Kanal]^ do
  26.   begin
  27.     if SplSave then
  28.     begin
  29.       Vstr := FName_aus_FVar(SplFile);
  30.       SplSave := false;
  31.       Spl_COR_ERR := false;
  32.       FiResult := CloseBin(SplFile);
  33.       Umlaut := Spl_UmlMerk;
  34.       if Klingel and BLTON then Beep(800,100);
  35.  
  36.       Vstr := copy(Vstr,1,pos(Pkt,Vstr)) + Cnt;
  37.       Assign(f,Vstr);
  38.       if RewriteTxt(f) = 0 then
  39.       begin
  40.         Writeln(f,Spl_gCount);
  41.         FiResult := CloseTxt(f);
  42.       end;
  43.     end else
  44.     begin
  45.       if MldOk = 11 then   (* 7PL .. P0X *)
  46.       begin
  47.         Spl_Time := Uhrzeit;
  48.         Spl_tCount := 0;
  49.         Spl_tLaenge := str_int('$' + ParmStr(7,B1,Zeile));
  50.         Spl_tLaenge := (Spl_tLaenge div 64) +  2;
  51.  
  52.         i1 := str_int(ParmStr(4,B1,Zeile));
  53.         Spl_gLaenge := str_int(ParmStr(6,B1,Zeile));
  54.         Spl_gLaenge := (Spl_gLaenge div 62) +  2 * i1;
  55.         if Spl_gLaenge mod 62 > 0 then inc(Spl_gLaenge);
  56.         Spl_gLaenge := Spl_gLaenge * 69;
  57.         Spl_tLaenge := Spl_tLaenge * 69;
  58.  
  59.         Nstr := copy(Zeile,20,8);
  60.  
  61.         While pos(BS,Nstr) > 0 do delete(Nstr,1,pos(BS,Nstr));
  62.         While pos(Sst,Nstr) > 0 do delete(Nstr,1,pos(Sst,Nstr));
  63.         While pos(DP,Nstr) > 0 do delete(Nstr,1,pos(DP,Nstr));
  64.         While pos(Pkt,Nstr) = 1 do delete(Nstr,1,1);
  65.  
  66.         i := pos(Pkt,Nstr);
  67.         if i > 0 then Nstr := copy(Nstr,1,i-1);
  68.         KillEndBlanks(Nstr);
  69.         if Nstr = '' then
  70.         begin
  71.           Nstr := Call;
  72.           Strip(Nstr);
  73.         end;
  74.         if i1 = 1 then Suf := '7PL'
  75.                   else Suf := 'P' + Hex(str_int(ParmStr(2,B1,Zeile)),2);
  76.         Nstr := Nstr + Pkt + Suf;
  77.       end;
  78.  
  79.       if MldOk = 14 then   (* COR und ERR-File *)
  80.       begin
  81.         Spl_COR_ERR := true;
  82.         Nstr := ParmStr(2,B1,Zeile);
  83.  
  84.         While pos(BS,Nstr) > 0 do delete(Nstr,1,pos(BS,Nstr));
  85.         While pos(Sst,Nstr) > 0 do delete(Nstr,1,pos(Sst,Nstr));
  86.         While pos(DP,Nstr) > 0 do delete(Nstr,1,pos(DP,Nstr));
  87.         While pos(Pkt,Nstr) = 1 do delete(Nstr,1,1);
  88.  
  89.         i := 0;
  90.         While Exists(G^.SPlusPfad + copy(Nstr,1,pos(Pkt,Nstr)-1) + BS + Nstr) do
  91.         begin
  92.           inc(i);
  93.           delete(Nstr,length(Nstr)-1,2);
  94.           Nstr := Nstr + SFillStr(2,'0',Hex(i,2));
  95.         end;
  96.       end;
  97.  
  98.       Vstr := copy(Nstr,1,pos(Pkt,Nstr)-1);
  99.  
  100.       if MkSub(G^.SPlusPfad + Vstr) then
  101.       begin
  102.         if not Exists(G^.SPlusPfad + Vstr + BS  + Nstr) then
  103.         begin
  104.           Vstr := G^.SPlusPfad + Vstr + BS  + Nstr;
  105.           Assign(SplFile,Vstr);
  106.           Result := RewriteBin(SplFile,T);
  107.         end else
  108.         begin
  109.           i := 0;
  110.           Repeat
  111.             inc(i);
  112.             Sstr := Call;
  113.             Strip(Sstr);
  114.             Sstr := int_str(i) + Sstr;
  115.             Flag := not Exists(G^.SPlusPfad + Vstr + BS  + Sstr + BS  + Nstr);
  116.           Until Flag or (i > 250);
  117.           if Flag then
  118.           begin
  119.             if MkSub(G^.SPlusPfad + Vstr + BS  + Sstr) then
  120.             begin
  121.               Vstr := G^.SPlusPfad + Vstr + BS  + Sstr + BS  + Nstr;
  122.               Assign(SplFile,Vstr);
  123.               Result := RewriteBin(SplFile,T);
  124.             end else Result := 1;
  125.           end else Result := 1;
  126.         end;
  127.  
  128.         if Result = 0 then
  129.         begin
  130.           SplSave := true;
  131.           Spl_UmlMerk := Umlaut;
  132.           Umlaut := 0;
  133.           if Klingel and BLTON then Beep(1500,100);
  134.  
  135.           Vstr := copy(Vstr,1,pos(Pkt,Vstr)) + Cnt;
  136.           Assign(f,Vstr);
  137.           if ResetTxt(f) = 0 then
  138.           begin
  139.             Readln(f,Spl_gCount);
  140.             FiResult := CloseTxt(f);
  141.           end else Spl_gCount := 0;
  142.         end else
  143.         begin
  144.           Triller;
  145.           MldOk := 0;
  146.         end;
  147.       end else
  148.       begin
  149.         Triller;
  150.         MldOk := 0;
  151.       end;
  152.     end;
  153.     SetzeFlags(Kanal);
  154.   end;
  155. End;
  156.  
  157.  
  158. Procedure Close_7Plus (* Kanal : Byte *);
  159. Begin
  160.   with K[Kanal]^ do
  161.   begin
  162.     if SplSave then
  163.     begin
  164.       SplSave := false;
  165.       Spl_COR_ERR := false;
  166.       FiResult := CloseBin(SplFile);
  167.       Umlaut := Spl_UmlMerk;
  168.     end;
  169.   end;
  170. End;
  171.